WPS Office.apk(点击下载) / h.java


package com.appsflyer;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Looper;
import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.iflytek.cloud.SpeechUtility;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;
import org.scribe.model.OAuthConstants;

final class h implements Runnable {

    /* renamed from: ʼ  reason: contains not printable characters */
    private static String f142 = new StringBuilder("https://validate.%s/api/v").append(AppsFlyerLib.f23).append("/androidevent?buildnumber=4.8.12&app_id=").toString();

    /* renamed from: ʻ  reason: contains not printable characters */
    private String f143;

    /* renamed from: ʽ  reason: contains not printable characters */
    private String f144;

    /* renamed from: ˊ  reason: contains not printable characters */
    private String f145;

    /* renamed from: ˊॱ  reason: contains not printable characters */
    private final Intent f146;

    /* renamed from: ˋ  reason: contains not printable characters */
    private String f147;

    /* renamed from: ˎ  reason: contains not printable characters */
    private String f148;

    /* renamed from: ˏ  reason: contains not printable characters */
    private WeakReference<Context> f149 = null;

    /* renamed from: ॱ  reason: contains not printable characters */
    private String f150;

    /* renamed from: ॱॱ  reason: contains not printable characters */
    private ScheduledExecutorService f151;

    /* renamed from: ᐝ  reason: contains not printable characters */
    private Map<String, String> f152;

    h(Context context, String str, String str2, String str3, String str4, String str5, String str6, Map<String, String> map, ScheduledExecutorService scheduledExecutorService, Intent intent) {
        this.f149 = new WeakReference<>(context);
        this.f150 = str;
        this.f147 = str2;
        this.f145 = str4;
        this.f144 = str5;
        this.f143 = str6;
        this.f152 = map;
        this.f148 = str3;
        this.f151 = scheduledExecutorService;
        this.f146 = intent;
    }

    /* JADX WARNING: Removed duplicated region for block: B:41:0x0149  */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x0151  */
    /* JADX WARNING: Removed duplicated region for block: B:55:? A[RETURN, SYNTHETIC] */
    /* renamed from: ˋ  reason: contains not printable characters */
    static /* synthetic */ void m137(h hVar, Map map, Map map2, WeakReference weakReference) {
        HttpURLConnection httpURLConnection;
        Throwable th;
        if (weakReference.get() != null) {
            String obj = new StringBuilder().append(ServerConfigHandler.getUrl(f142)).append(((Context) weakReference.get()).getPackageName()).toString();
            SharedPreferences sharedPreferences = ((Context) weakReference.get()).getSharedPreferences("appsflyer-data", 0);
            String string = sharedPreferences.getString("referrer", null);
            if (string == null) {
                string = "";
            }
            Map<String, Object> r1 = AppsFlyerLib.getInstance().m79((Context) weakReference.get(), hVar.f150, AFInAppEventType.PURCHASE, "", string, true, sharedPreferences, false, hVar.f146);
            r1.put(FirebaseAnalytics.Param.PRICE, hVar.f144);
            r1.put(FirebaseAnalytics.Param.CURRENCY, hVar.f143);
            JSONObject jSONObject = new JSONObject(r1);
            JSONObject jSONObject2 = new JSONObject();
            try {
                for (Map.Entry entry : map.entrySet()) {
                    jSONObject2.put((String) entry.getKey(), entry.getValue());
                }
                jSONObject.put("receipt_data", jSONObject2);
            } catch (JSONException e) {
                AFLogger.afErrorLog("Failed to build 'receipt_data'", e);
            }
            if (map2 != null) {
                JSONObject jSONObject3 = new JSONObject();
                try {
                    for (Map.Entry entry2 : map2.entrySet()) {
                        jSONObject3.put((String) entry2.getKey(), entry2.getValue());
                    }
                    jSONObject.put("extra_prms", jSONObject3);
                } catch (JSONException e2) {
                    AFLogger.afErrorLog("Failed to build 'extra_prms'", e2);
                }
            }
            String jSONObject4 = jSONObject.toString();
            u.m204().m219(obj, jSONObject4);
            try {
                httpURLConnection = m138(jSONObject4, obj);
                int i = -1;
                if (httpURLConnection != null) {
                    try {
                        i = httpURLConnection.getResponseCode();
                    } catch (Throwable th2) {
                        th = th2;
                        try {
                            AFLogger.afErrorLog(th.getMessage(), th);
                            if (httpURLConnection == null) {
                                httpURLConnection.disconnect();
                                return;
                            }
                            return;
                        } catch (Throwable th3) {
                            th = th3;
                            if (httpURLConnection != null) {
                                httpURLConnection.disconnect();
                            }
                            throw th;
                        }
                    }
                }
                AppsFlyerLib.getInstance();
                String r3 = AppsFlyerLib.m51(httpURLConnection);
                u.m204().m215(obj, i, r3);
                JSONObject jSONObject5 = new JSONObject(r3);
                if (i == 200) {
                    AFLogger.afInfoLog(new StringBuilder("Validate-WH response - 200: ").append(jSONObject5.toString()).toString());
                } else {
                    AFLogger.afWarnLog(new StringBuilder("Validate-WH response failed - ").append(i).append(": ").append(jSONObject5.toString()).toString());
                }
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            } catch (Throwable th4) {
                th = th4;
                httpURLConnection = null;
                if (httpURLConnection != null) {
                }
                throw th;
            }
        }
    }

    /* renamed from: ˏ  reason: contains not printable characters */
    private static HttpURLConnection m138(String str, String str2) throws IOException {
        try {
            n nVar = new n(null, AppsFlyerLib.getInstance().isTrackingStopped());
            nVar.f177 = str;
            nVar.m157();
            if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
                AFLogger.afDebugLog(new StringBuilder("Main thread detected. Calling ").append(str2).append(" in a new thread.").toString());
                nVar.execute(str2);
            } else {
                AFLogger.afDebugLog(new StringBuilder("Calling ").append(str2).append(" (on current thread: ").append(Thread.currentThread().toString()).append(" )").toString());
                nVar.onPreExecute();
                nVar.onPostExecute(nVar.doInBackground(str2));
            }
            return nVar.m158();
        } catch (Throwable th) {
            AFLogger.afErrorLog("Could not send callStats request", th);
            return null;
        }
    }

    /* renamed from: ˏ  reason: contains not printable characters */
    private static void m139(boolean z, String str, String str2, String str3, String str4) {
        if (AppsFlyerLib.f19 != null) {
            AFLogger.afDebugLog(new StringBuilder("Validate callback parameters: ").append(str).append(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR).append(str2).append(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR).append(str3).toString());
            if (z) {
                AFLogger.afDebugLog("Validate in app purchase success: ".concat(String.valueOf(str4)));
                AppsFlyerLib.f19.onValidateInApp();
                return;
            }
            AFLogger.afDebugLog("Validate in app purchase failed: ".concat(String.valueOf(str4)));
            AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = AppsFlyerLib.f19;
            if (str4 == null) {
                str4 = "Failed validating";
            }
            appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure(str4);
        }
    }

    public final void run() {
        if (this.f150 != null && this.f150.length() != 0 && !AppsFlyerLib.getInstance().isTrackingStopped()) {
            HttpURLConnection httpURLConnection = null;
            try {
                Context context = this.f149.get();
                if (context != null) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("public-key", this.f147);
                    hashMap.put("sig-data", this.f145);
                    hashMap.put("signature", this.f148);
                    final HashMap hashMap2 = new HashMap();
                    hashMap2.putAll(hashMap);
                    Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() {
                        /* class com.appsflyer.h.AnonymousClass3 */

                        public final void run() {
                            h.m137(h.this, hashMap2, h.this.f152, h.this.f149);
                        }
                    }, 5, TimeUnit.MILLISECONDS);
                    hashMap.put("dev_key", this.f150);
                    hashMap.put("app_id", context.getPackageName());
                    hashMap.put("uid", AppsFlyerLib.getInstance().getAppsFlyerUID(context));
                    hashMap.put(ServerParameters.ADVERTISING_ID_PARAM, AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM));
                    String jSONObject = new JSONObject(hashMap).toString();
                    String url = ServerConfigHandler.getUrl("https://sdk-services.%s/validate-android-signature");
                    u.m204().m219(url, jSONObject);
                    HttpURLConnection r1 = m138(jSONObject, url);
                    int i = -1;
                    if (r1 != null) {
                        i = r1.getResponseCode();
                    }
                    AppsFlyerLib.getInstance();
                    String r4 = AppsFlyerLib.m51(r1);
                    u.m204().m215(url, i, r4);
                    JSONObject jSONObject2 = new JSONObject(r4);
                    jSONObject2.put(OAuthConstants.CODE, i);
                    if (i == 200) {
                        AFLogger.afInfoLog(new StringBuilder("Validate response 200 ok: ").append(jSONObject2.toString()).toString());
                        m139(jSONObject2.optBoolean(SpeechUtility.TAG_RESOURCE_RESULT) ? jSONObject2.getBoolean(SpeechUtility.TAG_RESOURCE_RESULT) : false, this.f145, this.f144, this.f143, jSONObject2.toString());
                    } else {
                        AFLogger.afInfoLog("Failed Validate request");
                        m139(false, this.f145, this.f144, this.f143, jSONObject2.toString());
                    }
                    if (r1 != null) {
                        r1.disconnect();
                    }
                }
            } catch (Throwable th) {
                if (0 != 0) {
                    httpURLConnection.disconnect();
                }
                throw th;
            }
        }
    }
}